export default class BaseRemote {

  async postData(url, header, body) {
    return this.requestData(url, 'POST', header, body);
  }

  async getData(url, header, body) {
    return this.requestData(url, 'GET', header, body);
  }

  requestData(url, method, header, body) {
    return window.fetch(url, {
      method: method,
      headers: header,
      body: body ? (body) : null,
    }).then((data) => {
      return data;
    }).catch((error) => {
      throw error;
    })
  }
}
